package sctu.edu.java.year2016.team01.xuhanmei.day20160525;

/**
 * Created by Administrator on 2016/5/25.
 */
public class HanoiTower {
    public static void moveDish(int level, char from, char inter, char to) {


        if (level == 1) {//如果盘子等于1就退出迭代。
            System.out.println("从" + from + "移动1号到" + to);
        } else {//如果大于1就继续迭代
            moveDish(level - 1, from, to, inter);
            System.out.println("从" + from + "移动盘子" + level + "号到" + to);
            moveDish(level - 1, inter, from, to);
        }
    }


    public static void main(String[] args) {
        int nDisks = 3;
        moveDish(nDisks, 'A', 'B', 'c');
    }
}